home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tcxl551.arc / TCXL_INC.EXE / lha / INC / TCXLWIN.H < prev   
Text File  |  1990-10-01  |  16KB  |  279 lines

  1. /*=====[ The TesSeRact(TM) CXL User Interface Development System ]======*
  2.  | Copyright (c) 1987-1990, Innovative Data Concepts. All Rights Reserved
  3.  |
  4.  | This Library is part of IDC's TesSeRact Development Tools product
  5.  | line. For information about other IDC products, call 1-215-884-3373.
  6.  *----------------------------------------------------------------------*
  7.  | <TCXLwin.h> : Public definitions and prototypes for TCXL windowing
  8.  | system.
  9.  *----------------------------------------------------------------------*
  10.  | PGS : $Id: tcxlwin.h 5.51 90/10/01 00:00:00 MLM Release Locker: MLM $
  11.  | $Log:    tcxlwin.h $
  12.  | Revision 5.51  90/10/01  00:00:00  MLM
  13.  | TCXL 5.51
  14.  | 
  15.  *======================================================================*/
  16. #ifndef  _TCXLwin_
  17. #  define   _TCXLwin_ 1
  18. #  ifndef   _TCXLvid_
  19. #    include <TCXLvid.h>   /* video definitions */
  20. #  endif
  21. #  ifndef   _TCXLerr_
  22. #    include <TCXLerr.h>   /* error definitions */
  23. #  endif
  24.                               /*- Box types ----------------------------*/
  25. #define  BOX_SNG  0x00        /* all single                 */
  26. #define  BOX_DBL  0x01        /* all double                 */
  27. #define  BOX_VER  0x02        /* horiz single, vert double  */
  28. #define  BOX_HOR  0x03        /* horiz double, vert single  */
  29. #define  BOX_HVY  0x04        /* heavy lines                */
  30. #define  BOX_SPA  0x05        /* spaces                     */
  31.                               /*- Border sides -------------------------*/
  32. #define  BRD_TOP  0x00        /* Top      */
  33. #define  BRD_BOT  0x01        /* Bottom   */
  34. #define  BRD_LFT  0x02        /* Left     */
  35. #define  BRD_RGT  0x03        /* Right    */
  36.                               /*- Wcenter(), WpopUp centering flags ----*/
  37. #define  CNT_HOR  0x01        /* Horizontal  */
  38. #define  CNT_VER  0x02        /* Vertical    */
  39. #define  CNT_CNT  0x03        /* Both        */
  40.                               /*- Direction codes ----------------------*/
  41. #define  DIR_DWN  0x00        /* Down  */
  42. #define  DIR_UP   0x01        /* Up    */
  43. #define  DIR_LFT  0x02        /* Left  */
  44. #define  DIR_RGT  0x03        /* Right */
  45.                               /*- Wtitle() title positions -------------*/
  46. #define  TTL_LFT  0x01        /* Left     */
  47. #define  TTL_CNT  0x02        /* Center   */
  48. #define  TTL_RGT  0x03        /* Right    */
  49.  
  50. /*------------------[ Data objects and access macros ]------------------*/
  51.  
  52. TYP   struct   Box   BoxT,  *BoxP;
  53. TYP   struct   Ttl   TtlT,  *Ttlp;
  54. TYP   struct   Wctl  WctlT, *WctlP;
  55. TYP   struct   Wdf   WdfT,  *WdfP;
  56.  
  57. struct   Box            /*-[ Window-frame object ]-------*/
  58. {  BytT  btyp;          /* 00|00 : type                  */
  59.    BytT  batr;          /* 01|01 : attribute             */
  60. };                      /* 02|02 ]-----------------------*/
  61. #define  BoxTyp(b)   ((b).btyp)
  62. #define  BoxAtr(b)   ((b).batr)
  63.  
  64. struct   Ttl            /*-[ Window-title object ]-------*/
  65. {  ChrP  tstr;          /* 00|00 : string                */
  66.    BytT  tpos;          /* 02|04 : position              */
  67.    AtrT  tatr;          /* 03|05 : attribute             */
  68. };                      /* 04|06 ]-----------------------*/
  69. #define  TtlStr(t)   ((t).tstr)
  70. #define  TtlPos(t)   ((t).tpos)
  71. #define  TtlAtr(t)   ((t).tatr)
  72.  
  73. struct   Wctl           /*-[ Window-control object ]--------*/
  74. {  WdfP  wact;          /* 00|00 : active window            */
  75.    WdfP  whid;          /* 02|04 : top hidden window        */
  76.    VOID  (CTYP *wfun)   /* 04|08 : fill-function            */
  77.       (WrdT, WrdT, IntT, IntT);
  78.    WndT  whdl;          /* 06|0C : last handle assigned     */
  79.    TagT  whlp;          /* 08|0E : current help category    */
  80.    IntT  wopn;          /* 0A|10 : total open windows       */
  81.    BytT  wesc;          /* 0C|12 : [Esc] checking ? 1 : 0   */
  82.    BytT  wtab;          /* 0D|13 : TTY output tab width     */
  83.    BytT  wfil;          /* 0E|14 : fill character           */
  84.    BytT  wflg;          /* 0F|15 : reserved flag byte       */
  85. };                      /* 10|16 ]--------------------------*/
  86.  
  87. GBL   WctlT CDC   _WinCtl;    /*- global window-control object ---------*/
  88. #define  WctlAct  (_WinCtl.wact)                   /* active window     */
  89. #define  WctlHid  (_WinCtl.whid)                   /* top hidden window */
  90. #define  WctlFun  (_WinCtl.wfun)                   /* fill function     */
  91. #define  WctlHdl  (_WinCtl.whdl)                   /* last handle       */
  92. #define  WctlHlp  (_WinCtl.whlp)                   /* help category     */
  93. #define  WctlOpn  (_WinCtl.wopn)                   /* total open        */
  94. #define  WctlEsc  (_WinCtl.wesc)                   /* [Esc] check       */
  95. #define  WctlTab  (_WinCtl.wtab)                   /* tab width         */
  96. #define  WctlFil  (_WinCtl.wfil)                   /* fill char         */
  97. #define  WctlFlg  (_WinCtl.wflg)                   /* flag byte         */
  98.  
  99. struct   Wdf            /*-[ Window-definition object ]--*/
  100. {  WdfP  wprv;          /* 00|00 : previous WdfT         */
  101.    WdfP  wnxt;          /* 02|04 : next WdfT             */
  102.    VcelP wbfr;          /* 04|08 : buffer                */
  103.    VcelP wsbf;          /* 06|0C : shadow buffer         */
  104.    TtlT  wttl;          /* 08|10 : title                 */
  105.    WndT  whdl;          /* 0C|14 : handle                */
  106.    TagT  whlp;          /* 0E|16 : help category         */
  107.    VposT wbeg;          /* 10|18 : start position        */
  108.    VposT wend;          /* 12|1A : end position          */
  109.    VposT wpos;          /* 14|1C : cursor position       */
  110.    BoxT  wfrm;          /* 16|1E : border                */
  111.    AtrT  wdat;          /* 18|20 : default attribute     */
  112.    AtrT  wcat;          /* 19|21 : current attribute     */
  113.    AtrT  wsat;          /* 1A|22 : shadow attribute      */
  114.    BytT  wbrd;          /* 1B|23 : border ? 1 : 0        */
  115. };                      /* 1C|24 ]-----------------------*/
  116.  
  117. #define  WdfPrv(w)   ((w)->wprv)                   /* previous WdfT     */
  118. #define  WdfNxt(w)   ((w)->wnxt)                   /* next WdfT         */
  119. #define  WdfBfr(w)   ((w)->wbfr)                   /* buffer            */
  120. #define  WdfSbf(w)   ((w)->wsbf)                   /* shadow buffer     */
  121. #define  WdfTtl(w)   ((w)->wttl)                   /* title             */
  122. #define  WdfTtlS(w)  (TtlStr(WdfTtl(w)))           /*    string         */
  123. #define  WdfTtlP(w)  (TtlPos(WdfTtl(w)))           /*    position       */
  124. #define  WdfTtlA(w)  (TtlAtr(WdfTtl(w)))           /*    attribute      */
  125. #define  WdfHdl(w)   ((w)->whdl)                   /* handle            */
  126. #define  WdfHlp(w)   ((w)->whlp)                   /* help category     */
  127. #define  WdfBeg(w)   ((w)->wbeg)                   /* start position    */
  128. #define  WdfBegW(w)  (VposW(WdfBeg(w)))            /*    word           */
  129. #define  WdfBegC(w)  (VposC(WdfBeg(w)))            /*    col            */
  130. #define  WdfBegR(w)  (VposR(WdfBeg(w)))            /*    row            */
  131. #define  WdfEnd(w)   ((w)->wend)                   /* end position      */
  132. #define  WdfEndW(w)  (VposW(WdfEnd(w)))            /*    word           */
  133. #define  WdfEndC(w)  (VposC(WdfEnd(w)))            /*    col            */
  134. #define  WdfEndR(w)  (VposR(WdfEnd(w)))            /*    row            */
  135. #define  WdfPos(w)   ((w)->wpos)                   /* cursor position   */
  136. #define  WdfPosW(w)  (VposW(WdfPos(w)))            /*    word           */
  137. #define  WdfPosC(w)  (VposC(WdfPos(w)))            /*    col            */
  138. #define  WdfPosR(w)  (VposR(WdfPos(w)))            /*    row            */
  139. #define  WdfFrm(w)   ((w)->wfrm)                   /* border            */
  140. #define  WdfFrmT(w)  (BoxTyp(WdfFrm(w)))           /*    type           */
  141. #define  WdfFrmA(w)  (BoxAtr(WdfFrm(w)))           /*    attribute      */
  142. #define  WdfDat(w)   ((w)->wdat)                   /* default attribute */
  143. #define  WdfCat(w)   ((w)->wcat)                   /* current attribute */
  144. #define  WdfSat(w)   ((w)->wsat)                   /* shadow attribute  */
  145. #define  WdfBrd(w)   ((w)->wbrd)                   /* border            */
  146.  
  147. /*------------------------[ Function prototypes ]-----------------------*
  148.  | [A] indicates active window in comments
  149.  */
  150. #ifdef   __cplusplus       /* no mangling, please */
  151.    extern "C" {
  152. #endif
  153.                                        /*- general ---------------------*/
  154. IntT  CTYP  Wactiv(WndT wh);           /* Activate window <wh>          */
  155. IntT  CTYP  WcloseAll(NOARG);          /* Close all windows             */
  156. ChrP  CTYP  WerrMsg(NOARG);            /* get error-message text        */
  157. VOID  CTYP  Werror(NOARG);             /* exit with error-message       */
  158. WndT  CTYP  Windowat(IntT sr,          /* Handle of window at position  */
  159.    IntT sc);
  160. WdfP  CTYP  WinLoc(WndT wh);           /* Find window by handle         */
  161. IntT        Wisactiv(WndT a);          /* Test for active handle        */
  162. WndT  CTYP  Wopen(IntT sr, IntT sc,    /* Open window                   */
  163.    IntT er, IntT ec, IntT bt, IntT ba, IntT wa);
  164. IntT  CTYP  Wperror(ChrP mp);          /* Display error window          */
  165. WndT  CTYP  WpopUp(IntT cf, IntT sr,   /* Open centered window          */
  166.    IntT sc, IntT er, IntT ec, IntT bt, IntT ba, IntT wa);
  167. VOID  CTYP  Wrestore(VcelP wb);        /* Restore saved window          */
  168. VcelP CTYP  Wsave(IntT sr, IntT sc,    /* Save window                   */
  169.    IntT er, IntT ec);
  170. VOID        WsetEsc(IntT a);           /* Enable/Disable [Esc] key      */
  171. VOID        WsetFil(IntT a);           /* Set fill char                 */
  172. IntT  CTYP  WsetFun(                   /* Set fill function             */
  173.    VOID (CTYP *f)(WrdT, WrdT, IntT, IntT));
  174. VOID        WsetTab(IntT a);           /* Set tab-width                 */
  175. IntT  CTYP  WsetTxt(IntT a);           /* Set text attr                 */
  176. IntT  CTYP  Wunhide(WndT wh);          /* Unhide window <wh>            */
  177. IntT  CTYP  Wunlink(WndT wh);          /* Unlink window <wh>            */
  178. IntT  CTYP  Wwprints(WndT wh, IntT wr, /* Put string to window <wh>     */
  179.    IntT wc, IntT at, ChrP ps);
  180.                                        /*- active window movement ------*/
  181. IntT  CTYP  Wcenter(IntT cf);          /* Center window on screen   [A] */
  182. IntT  CTYP  Wclose(NOARG);             /* Close window              [A] */
  183. WndT  CTYP  Wcopy(IntT nr, IntT nc);   /* Copy window               [A] */
  184. IntT  CTYP  Wdrag(IntT df);            /* Drag one row or col       [A] */
  185. IntT  CTYP  Wdump(NOARG);              /* Dump window to printer    [A] */
  186. WndT  CTYP  Whandle(NOARG);            /* Get active handle         [A] */
  187. IntT  CTYP  Whide(NOARG);              /* Hide window               [A] */
  188. IntT  CTYP  Wmove(IntT sr, IntT sc);   /* Move window               [A] */
  189. IntT  CTYP  Wsize(IntT nr, IntT nc);   /* Resize window             [A] */
  190. IntT  CTYP  Wslide(IntT sr,IntT sc);   /* Slide window              [A] */
  191.                                        /*- active window-control -------*/
  192. IntT  CTYP  WchgAtr(IntT ba, IntT wa); /* Change window/border attr [A] */
  193. IntT  CTYP  WchkBox(IntT sr, IntT sc,  /* Check box coords          [A] */
  194.    IntT er, IntT ec);
  195. IntT  CTYP  WchkCol(IntT wc);          /* Check column              [A] */
  196. IntT  CTYP  WchkPos(IntT wr, IntT wc); /* Check position            [A] */
  197. IntT  CTYP  WchkRow(IntT wr);          /* Check row                 [A] */
  198. IntT        Wclear(NOARG);             /* Clear window to default   [A] */
  199. IntT  CTYP  WclrEol(NOARG);            /* Clear cursor to EOL       [A] */
  200. IntT  CTYP  WclrEos(NOARG);            /* Clear to end of window    [A] */
  201. IntT  CTYP  WclrWin(IntT at);          /* Clear window              [A] */
  202. IntT  CTYP  WfilBox(IntT sr, IntT sc,  /* Fill region               [A] */
  203.    IntT er, IntT ec, IntT ch,IntT at);
  204. IntT  CTYP  WlinDel(IntT wr, IntT df); /* Delete line               [A] */
  205. IntT  CTYP  WlinIns(IntT wr, IntT di); /* Insert line               [A] */
  206. IntT  CTYP  WscrBox(IntT sr,           /* Scroll region             [A] */
  207.    IntT sc, IntT er,IntT  ec, IntT n, IntT d);
  208. IntT  CTYP  WscrWin(IntT n, IntT d);   /* Scroll window             [A] */
  209.                                        /*- active border, box drawing --*/
  210. IntT  CTYP  Wborder(IntT bt);          /* Add border                [A] */
  211. IntT  CTYP  Wbprintc(IntT bd, IntT of, /* Put char/attr on border   [A] */
  212.    IntT at, IntT ch);
  213. IntT  CTYP  WdrwBox(IntT sr, IntT sc,  /* Draw internal box         [A] */
  214.    IntT er, IntT ec, IntT bt, IntT at);
  215. IntT  CTYP  WdrwHor(IntT sr, IntT sc,  /* Draw horizontal line      [A] */
  216.    IntT nc, IntT bt, IntT at);
  217. IntT  CTYP  WdrwVer(IntT sr, IntT sc,  /* Draw vertical line        [A] */
  218.    IntT n, IntT bt, IntT at);
  219. IntT  CTYP  Wmessage(ChrP ps, IntT bo, /* Put message on border     [A] */
  220.    IntT lo, IntT at);
  221. IntT  CTYP  Wtitle(ChrP ps, IntT tp,   /* Put title on border       [A] */
  222.    IntT ta);
  223.                                        /*- active window shadow --------*/
  224. IntT  CTYP  Wshadoff(NOARG);           /* Remove shadow             [A] */
  225. IntT  CTYP  Wshadow(IntT at);          /* Add shadow                [A] */
  226.                                        /*- active window cursor --------*/
  227. VOID        WcurGet(VposT rc);         /* Get position              [A] */
  228. IntT        WcurPut(VposT rc);         /* Put cursor                [A] */
  229. IntT  CTYP  Wgotoxy(IntT wr, IntT wc); /* Set position              [A] */
  230. IntT  CTYP  Wpgotoxy(IntT wr,          /* Provisional position      [A] */
  231.    IntT wc);
  232. VOID        WposGet(IntT r, IntT c);   /* get cursor position as <r,c>  */
  233.                               /*- Active Output / Current Cursor/Attrib */
  234. VOID  CTYP  WdupChr(IntT ch, IntT nd); /* Put duplicated char       [A] */
  235. VOID  CTYP  WdupStr(ChrP ps,IntT nd);  /* Put duplicated string     [A] */
  236. IntT  CTYP  WputCen(ChrP ps);          /* Put centered string       [A] */
  237. IntT  CTYP  WputFmt(ChrP fs, ChrP ps); /* Format-string output      [A] */
  238. VOID  CTYP  Wputc(IntT ch);            /* Put char                  [A] */
  239. IntT  CDC   Wputf(ChrP fs, ...);       /* Put printf() string       [A] */
  240. VOID  CTYP  Wputs(ChrP ps);            /* Put string [A]                */
  241. VOID  CTYP  Wputns(ChrP ps, IntT wd);  /* Put limited string        [A] */
  242. IntT  CTYP  Wputrj(ChrP ps);           /* Right-justify string/attr [A] */
  243. IntT  CTYP  Wputsw(ChrP ps);           /* Put string with word-wrap [A] */
  244.                               /*- Active Output / Passed Cursor/Attrib -*/
  245. VOID  CTYP  WdupChrA(IntT wr, IntT wc, /* Put duplicated char/attr  [A] */
  246.    IntT at, IntT ch, IntT nd);
  247. VOID  CTYP  WdupStrA(IntT wr, IntT wc, /* Put duplicated str/attr   [A] */
  248.    IntT at, ChrP ps, IntT nd);
  249. IntT  CTYP  WprtCen(IntT wr, IntT at,  /* Put centered string/attr  [A] */
  250.    ChrP ps);
  251. IntT  CTYP  WprtFmt(IntT wr, IntT wc,  /* Format-string/attr output [A] */
  252.    IntT at, ChrP fs, ChrP ps);
  253. IntT  CTYP  Wprtc(IntT wr, IntT wc,    /* Put char/attr             [A] */
  254.    IntT at, IntT ch);
  255. IntT  CDC   Wprtf(IntT wr, IntT wc,    /* Put printf() string/attr  [A] */
  256.    IntT at, ChrP fs, ...);
  257. VOID  CTYP  Wprtns(IntT wr, IntT wc,   /* Put limited string/attr   [A] */
  258.    IntT at, ChrP ps, IntT wd);
  259. IntT  CTYP  Wprtrj(IntT wr, IntT wc,   /* Right-justify string/attr [A] */
  260.    IntT at, ChrP ps);
  261. IntT  CTYP  Wprts(IntT wr, IntT wc,    /* Put string/attr           [A] */
  262.    IntT at, ChrP ps);
  263. IntT  CTYP  Wprtsw(IntT wr, IntT wc,   /* Put string/attr with wrap [A] */
  264.    IntT at, ChrP ps);
  265. WrdT  CTYP  WcurGt_(NOARG);            /*- internals -------------------*/
  266. IntT  CTYP  WcurPt_(WrdT rc);
  267. #define  Wclear()     (WclrWin(WdfDat(WctlAct)))
  268. #define  WcurGet(rc)  (VposW(rc)=WcurGt_())
  269. #define  WcurPut(rc)  (WcurPt_(VposW(rc)))
  270. #define  WsetFil(a)   (WctlFil=(a))
  271. #define  Wisactiv(a)  ((a)==WdfHdl(WctlAct))
  272. #define  WposGet(r,c) ((c)=MsInt(WcurGt_()); (r)=((c)>>8); (c)&=0xFF)
  273. #define  WsetEsc(a)   (WctlEsc=(a))
  274. #define  WsetTab(a)   (WctlTab=(((a)==0)?1:(a)))
  275. #ifdef   __cplusplus
  276.    }
  277. #endif
  278. #endif   /* _TCXLwin_ : End of TCXLwin.h */
  279.